/*
 *    Copyright (c) 2018-2025, boss All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 * Redistributions of source code must retain the above copyright notice,
 * this list of conditions and the following disclaimer.
 * Redistributions in binary form must reproduce the above copyright
 * notice, this list of conditions and the following disclaimer in the
 * documentation and/or other materials provided with the distribution.
 * Neither the name of the boss developer nor the names of its
 * contributors may be used to endorse or promote products derived from
 * this software without specific prior written permission.
 * Author: boss
 */

package com.hopes.bizz.poll.alarm.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import com.hopes.bizz.common.core.validate.group.AddGroup;
import com.hopes.bizz.common.core.validate.group.UpdateGroup;
import com.hopes.bizz.poll.alarm.bo.AlarmClassificationConfig;
import com.hopes.bizz.poll.common.constant.enums.PollModDictEnum;
import com.hopes.boss.admin.api.resolver.DictResolver;
import com.hopes.boss.common.entity.BaseLogicEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.validation.constraints.NotNull;

/**
 * 分级报警配置
 *
 * @author daijie
 * @date 2023-05-29 09:58:15
 */
@Data
@TableName(value ="poll_alarm_config", autoResultMap = true)
@EqualsAndHashCode(callSuper = true)
@Schema(description = "分级报警配置")
public class PollAlarmConfigEntity extends BaseLogicEntity {

    private static final long serialVersionUID = 1L;

	/**
	* id
	*/
    @TableId(type = IdType.ASSIGN_ID)
    @Schema(description="id")
    private Long id;
 
	/**
	* 是否全局
	*/
    @Schema(description="是否全局")
    private Boolean defaultFlag = false;
 
	/**
	* 监控点
	*/
    @Schema(description="监控点")
	@NotNull(message = "监控点不能为空", groups = {AddGroup.class, UpdateGroup.class})
    private Long monitorSiteId;
 
	/**
	* 超标配置
	*/
    @Schema(description="超标配置")
	@TableField(typeHandler = JacksonTypeHandler.class)
    private AlarmClassificationConfig alarmConfig;
 
	/**
	* 断网配置
	*/
    @Schema(description="断网配置")
	@TableField(typeHandler = JacksonTypeHandler.class)
    private AlarmClassificationConfig netConfig;

	/**
	 * 异常配置
	 */
	@Schema(description="异常配置")
	@TableField(typeHandler = JacksonTypeHandler.class)
	private AlarmClassificationConfig exceptionConfig;

	/**
	* 备注
	*/
    @Schema(description="备注")
    private String remarks;

    private Long orgId;

	public String getMonitorSiteStr() {
		return DictResolver.getItemLabelByValue(PollModDictEnum.monitor_site, this.monitorSiteId);
	}
}